package control;

import java.util.ArrayList;
import java.util.HashMap;

import org.eclipse.swt.graphics.Image;

import view.MemoryCard;

public class Storage {

	private static Storage store;

	public static synchronized Storage getInstance() {
		if (store == null) {
			store = new Storage();
		}
		return store;
	}

	private String sPlayer, sEnemy;

	private int iTurnsCount = 0;
	private int iPlayerCount = 0;
	private int iEnemyCount = 0;

	private boolean bConfigured = false;
	private boolean bTurnPause = false;
	private boolean bPlayerTurn = true;

	private ArrayList<MemoryCard> cards = new ArrayList<MemoryCard>();

	private HashMap<Integer, Image> imageMap = new HashMap<Integer, Image>();
	private HashMap<Integer, Integer> cardMap = new HashMap<Integer, Integer>();

	private Storage() {

	}

	public void addCard(MemoryCard card) {
		cards.add(card);
	}

	public ArrayList<MemoryCard> getCards() {
		return cards;
	}

	public String getEnemyName() {
		return sEnemy;
	}

	public int getEnemyPairCount() {
		return iEnemyCount;
	}

	public HashMap<Integer, Image> getImageMap() {
		return imageMap;
	}

	public String getPlayerName() {
		return sPlayer;
	}

	public int getPlayerPairCount() {
		return iPlayerCount;
	}

	public int getTurnsCount() {
		return iTurnsCount;
	}

	public void increaseEnemyPair() {
		iEnemyCount++;
	}

	public void increasePlayerPair() {
		iPlayerCount++;
	}

	public void increaseTurn() {
		iTurnsCount++;
	}

	public boolean isConfigured() {
		return bConfigured;
	}

	public boolean isPlayerTurn() {
		return bPlayerTurn;
	}

	public boolean isTurnPause() {
		return bTurnPause;
	}

	public void setConfigured(boolean bConfigured) {
		this.bConfigured = bConfigured;
	}

	public void setEnemyName(String enemy) {
		sEnemy = enemy;
	}

	public void setImageMap(HashMap<Integer, Image> imageMap) {
		this.imageMap = imageMap;
	}

	public void setPlayerName(String player) {
		sPlayer = player;
	}

	public void setPlayerTurn(boolean bPlayerTurn) {
		this.bPlayerTurn = bPlayerTurn;
	}

	public void setTurnPause(boolean bTurnPause) {
		this.bTurnPause = bTurnPause;
	}

	public void setCardMap(HashMap<Integer, Integer> cardMap) {
		this.cardMap = cardMap;
	}

	public HashMap<Integer, Integer> getCardMap() {
		return cardMap;
	}

}
